<template>
    <view>
        <!-- parse <include src="../component/navigationBar.wxml"></include> -->
        <block>
            <view class="navigationBox" :style="'padding-top:' + nTop + 'px;height:' + nHeight + 'px;line-height:' + nHeight + 'px;--color:' + color + ';'">
                <view class="nBar" :style="'height:' + nHeight + 'px;top:' + nTop + 'px'">
                    <navigator class="ico" hoverClass="none" :openType="pages.length == 1 ? 'switchTab' : 'navigateBack'" :url="pages.length == 1 ? '/pages/index/index4' : ''">
                        {{ pages.length == 1 ? '' : '' }}
                    </navigator>
                    <view class="title">{{ nTitle }}</view>
                </view>
            </view>
        </block>
        <scroll-view
            @refresherrefresh="onPullDownRefresh"
            @scroll="binnd_scroll_index"
            @scrolltolower="onReachBottom"
            class="huxuan_list"
            :enableBackToTop="true"
            :enableFlex="true"
            lowerThreshold="300"
            :refresherEnabled="true"
            :refresherTriggered="triggered"
            :scrollTop="scrolltopNum_index"
            :scrollWithAnimation="true"
            :scrollY="true"
            :style="'margin-top:' + nTH + 'px;height:-webkit-calc(100vh - ' + nTH + 'px);--color:' + color + ';--rgbcolor:' + rgbcolor + ';'"
        >
            <block v-if="LIST.length > 0" v-for="(dl, index) in LIST" :key="index">
                <navigator :url="'/hnPages/huxuan/huxuan_detail?id=' + item.fid" v-for="(item, index1) in dl" :key="index1">
                    <view class="h3">{{ item.title }}</view>

                    <view class="pic">
                        <image mode="aspectFill" :src="item.path_b"></image>
                    </view>

                    <view class="djs">
                        <view class="font">
                            <block v-if="item.DJS.flag == 1">
                                <text class="sapn jzbmT">
                                    <text class="ico"></text>
                                    {{ item.DJS.title }}
                                </text>
                                <block v-for="(item2, index2) in item.DJS.djstime" :key="index2">
                                    <text class="sapn timestyle">{{ item2.num }}</text>

                                    {{ item2.t }}
                                </block>
                            </block>
                            <block v-else>{{ item.DJS.title }}</block>
                        </view>
                    </view>

                    <view class="dl">
                        <view class="dd">
                            <image mode="aspectFill" :src="item3" v-for="(item3, index2) in item.bmulist" :key="index2"></image>
                            <view class="partyflag">
                                <text :class="'span partyflag' + item.bmflag.f">进入</text>
                            </view>
                        </view>
                    </view>
                </navigator>
            </block>
            <view class="nodata" v-if="huxuan_nodata && LIST.length == 0">
                <image mode="aspectFit" src="/static/res/img/nodata.png"></image>
                暂无符合条件的内容　
                <text @tap="nodatabackFn" data-sokind="default" :style="'color:' + color">返回</text>
            </view>
            <view class="loading" v-if="loading_flag">
                <image class="loading_ico" src="/static/res/img/loading_ico.svg" v-if="loading_ico_flag"></image>
                <text>{{ loading_str }}</text>
            </view>
        </scroll-view>
        <view @tap="SOFn" class="btmKefuBtn loop_s_b_s" :style="'--rgbcolor:' + rgbcolor + ';'">
            <view class="i ico"></view>
            筛选
        </view>
        <view @tap.stop.prevent="SO_close_Fn" :class="'mask1 div_right_mask ' + div_right_mask_class" v-if="div_right_flag">
            <view @tap.stop.prevent="blankFn" :class="'div_right_box ' + div_right_box_class">
                <view class="div_left_so" :style="'padding-top:' + nTop + 'px;line-height:' + nHeight + 'px;'">
                    <view class="tbody">互选活动筛选</view>
                    <form @submit="SO_form_uid_submitFn" class="form_uid">
                        <input
                            autocomplete="off"
                            @blur="SO_uid_bindblurFn"
                            @confirm="SO_input_uid_submitFn"
                            class="input"
                            confirmType="search"
                            maxlength="20"
                            name="keyword"
                            placeholder="按活动ID/名称"
                            type="text"
                            :value="keyword"
                        />
                        <button class="ico" formType="submit" style="z-index: 9"></button>
                    </form>
                    <form @submit="SO_ext_submitFn" @reset.stop.prevent="SO_ext_resetFn" class="form_ext" :style="'--color:' + color + ';--rgbcolor:' + rgbcolor">
                        <view class="tbox" v-for="(item, idx) in SO" :key="idx">
                            <view class="h5 on">{{ item.tbody }}</view>

                            <view class="ul def col3">
                                <view
                                    @tap="SO_ext_liFn"
                                    :class="'li' + (WXS.indexOf(item.v, item2.i) ? ' ed' : '')"
                                    :data-fkind="item.fkind"
                                    :data-idx="idx"
                                    :data-v="item2.i"
                                    v-for="(item2, idx2) in item.arr"
                                    :key="idx2"
                                >
                                    {{ item2.v }}
                                </view>
                            </view>

                            <input hidden :name="item.f" type="text" :value="item.v" />
                        </view>
                        <view class="savebox">
                            <button class="reset" formType="reset">重置</button>
                            <button class="ico" formType="submit"> 确定</button>
                        </view>
                        <view class="blank"></view>
                    </form>
                </view>
            </view>
        </view>
    </view>
</template>
<script module="WXS" lang="wxs" src="@/res/www.a9a.cn.wxs"></script>
<script>
var t;
var a;
var i = require('../../@babel/runtime/helpers/defineProperty');
var n = require('../../res/www.a9a.cn.js');
var app = getApp();
var o = 2;
var s = true;
export default {
    data() {
        return {
            nTitle: '互选相亲会',
            triggered: true,
            loading_flag: false,
            loading_ico_flag: false,
            loading_str: '拼命加载中',
            color: '',
            rgbcolor: '',
            LIST: [],
            huxuan_nodata: false,
            SO: '',
            SHARE: '',
            div_right_mask_class: '',
            div_right_flag: false,
            keyword: '',
            nTop: '',
            nHeight: '',
            pages: [],
            scrolltopNum_index: 0,
            nTH: '',
            dl: [],
            div_right_box_class: '',
            idx2: 0
        };
    },
    onLoad: function (t) {
        var that = this;
        app.globalData.get_config('_ZEAI').then(function (t) {
            that.setData({
                color: app.globalData._ZEAI.color,
                rgbcolor: n.c16_rgb(app.globalData._ZEAI.color)
            });
            that.init();
        });
        app.globalData.get_navigationBarTopHeight(that);
    },
    onShow: function () {},
    onPullDownRefresh: function () {
        var that = this;
        uni.vibrateShort({
            type: 'heavy'
        });
        setTimeout(function () {
            a = '';
            that.setData({
                triggered: false,
                loading_flag: false,
                loading_str: '拼命加载中',
                LIST: [],
                huxuan_nodata: false
            });
            that.setloading('end', '拼命加载中');
            o = 2;
            that.init();
        }, 500);
    },
    onReachBottom: function () {
        var r = this.LIST;
        var that = this;
        if (s) {
            s = false;
            that.setloading('start', '拼命加载中');
            var u = {
                submitok: 'huxuan',
                p: o,
                openid: t.openid
            };
            n.empty(a) || (u = JSON.parse((JSON.stringify(u) + JSON.stringify(index_par)).replace(/}{/, ',')));
            app.globalData.ajax({
                url: 'huxuan.php',
                data: u,
                success: function (t) {
                    if (1 == t.flag) {
                        var a = r.length;
                        if (t.LIST.length < 1) {
                            that.setloading('end', '已全部加载完毕');
                            return void (s = false);
                        }
                        that.setData(i({}, 'LIST[' + a + ']', t.LIST));
                        o += 1;
                        s = true;
                    } else {
                        uni.showToast({
                            title: t.msg,
                            icon: 'none',
                            mask: true
                        });
                    }
                    that.setloading('end', '上拉加载更多');
                }
            });
        }
    },
    onShareAppMessage: function (t) {
        return {
            imageUrl: this.SHARE.imgurl,
            title: this.SHARE.title,
            path: '/hnPages/huxuan/huxuan'
        };
    },
    onShareTimeline: function () {
        return {
            imageUrl: this.SHARE.imgurl,
            title: this.SHARE.title,
            query: '',
            path: '/pages/huxuan/huxuan'
        };
    },
    methods: {
        init: function () {
            var that = this;
            uni.showLoading({
                title: '拼命加载中...',
                mask: true
            });
            s = false;
            var r = {
                submitok: 'huxuan',
                openid: (t = uni.getStorageSync('COOK_U')).openid
            };
            n.empty(a) || (r = JSON.parse((JSON.stringify(r) + JSON.stringify(a)).replace(/}{/, ',')));
            app.globalData.ajax({
                url: 'huxuan.php',
                data: r,
                success: function (t) {
                    var a;
                    if (1 == t.flag) {
                        if (0 == t.LIST.length) {
                            that.setData({
                                LIST: [],
                                SO: t.SO,
                                huxuan_nodata: true,
                                SHARE: t.SHARE
                            });
                        } else {
                            that.setData((i((a = {}), 'LIST[0]', t.LIST), i(a, 'SO', t.SO), i(a, 'SHARE', t.SHARE), a));
                        }
                    } else {
                        uni.showToast({
                            title: t.msg,
                            icon: 'none',
                            mask: true
                        });
                    }
                    s = true;
                    uni.hideLoading();
                }
            });
        },

        blankFn: function () {},

        SOFn: function () {
            this.setData({
                div_right_mask_class: 'alpha0_100',
                div_right_flag: true
            });
        },

        SO_close_Fn: function () {
            var that = this;
            this.setData({
                div_right_mask_class: 'alpha100_0'
            });
            setTimeout(function () {
                that.setData({
                    div_right_flag: false
                });
            }, 500);
        },

        SO_form_uid_submitFn: function (t) {
            var i = t.detail.value.keyword;
            a = {
                keyword: i
            };
            this.SO_close_Fn();
            this.init();
        },

        SO_input_uid_submitFn: function (t) {
            var i = t.detail.value;
            a = {
                keyword: i
            };
            this.SO_close_Fn();
            this.init();
        },

        SO_uid_bindblurFn: function (t) {
            var a = t.detail.value;
            this.setData({
                keyword: a
            });
        },

        SO_ext_liFn: function (t) {
            var a;
            var e = t.currentTarget.dataset.idx;
            var o = t.currentTarget.dataset.v;
            var s = t.currentTarget.dataset.fkind;
            var r = this.SO[e].v;
            a = n.empty(r) ? o : 'checkbox' == s ? (n.indexOf(r, o) ? (a = n.json_remove(r, o)).join(',') : r + ',' + o) : o;
            if (0 == o) {
                a = 0;
            }
            this.setData(i({}, 'SO[' + e + '].v', a));
        },

        SO_ext_submitFn: function (t) {
            (a = t.detail.value).keyword = this.keyword;
            this.SO_close_Fn();
            this.init();
        },

        SO_ext_resetFn: function (t) {
            var a = this.SO;
            for (var n in a) {
                this.setData(i({}, 'SO[' + n + '].v', 0));
            }
            this.setData({
                keyword: ''
            });
        },

        nodatabackFn: function (t) {
            a = '';
            this.setData({
                loading_flag: false,
                loading_str: '拼命加载中',
                LIST: [],
                huxuan_nodata: false
            });
            o = 2;
            this.init();
        },

        setloading: function (t, a) {
            'start' == t
                ? this.setData({
                      loading_flag: true,
                      loading_ico_flag: true,
                      loading_str: a
                  })
                : this.setData({
                      loading_flag: false,
                      loading_ico_flag: false,
                      loading_str: a
                  });
        },

        binnd_scroll_index: function (t) {},

        onPullDownRefresh() {
            console.log('占位：函数 onPullDownRefresh 未声明');
        },

        onReachBottom() {
            console.log('占位：函数 onReachBottom 未声明');
        }
    }
};
</script>
<style>
@import 'huxuan.css';
</style>
